package com.luzh.myspring.core.io;

import cn.hutool.core.util.StrUtil;
/**
 * 默认资源加载器
 */
public class DefaultResourceLoader implements ResourceLoader{

    /**
     * 根据不同路径加载不同资源
     * @param location
     * @return
     */
    @Override
    public Resource getResource(String location) {
        if(StrUtil.isEmpty(location))
            throw new NullPointerException("Location must not be empty");
        if (location.startsWith(CLASSPATH_URL_PREFIX)) {
            return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()));
        } else {
            //从其他地方加载
        }
        return null;
    }
}
